package com.aaa.methodreference.demo01;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/**
 * @author C-Q
 * @version 1.1.0
 * @Description: TODO
 * @date 2022/11/4
 */
public class Test02 {
    public static void main(String[] args) {
        List<Integer> list = new ArrayList<>();

        list.add(2);
        list.add(6);
        list.add(4);
        list.add(1);
        list.add(5);
//        Comparator<Integer> comparator=(o1, o2) -> Integer.compare(o1,o2);
        Comparator<Integer> comparator=Integer::compare;
        Collections.sort(list,comparator);
        System.out.println(list);
    }
}
